<?php


class NTheme extends NObject{

var $name="default";
var $charset="UTF-8";
var $description="";
var $keywords="";
var $title="";
function &getInstance ($name='default')

    // this implements the 'singleton' design pattern.

    {

        static $instances;

        

        if (!isset($instances[$name])) {

            $c = __CLASS__;

            $instances[$name] = new $c($name);

        } // if


        return $instances[$name];

        

    } // getInstance
function __construct($name){
		$this->setTheme($name);

}


function setTheme($name="default"){
$this->setThemeAlt($name,$themeurl=THEMES_URL,$themedir=THEMES_DIR);
}
function setThemeAlt($name,$themeurl=THEMES_URL,$themedir=THEMES_DIR){
$this->set("name",$name);
$this->set("baseurl",$themeurl."/".$this->get('name'));
$this->set("basedir",$themedir."/".$this->get('name'));
}
function render(){
	global $theme_layout;
$theme_file = "index.phtml";
if ($theme_layout) {
  $theme_file = "index_$theme_layout.phtml";
}
ob_start();
include $this->get("basedir")."/$theme_file";
$_return=ob_get_contents();
ob_clean();
return $_return;
}
}
?>